(function (_super) {
    var Pool = [];
    var PROPS = {
        "10003" : 1,   // 针
        "10004" : 1,   // 防御盾
        "10005" : 1,   // 透视镜
        "10006" : 1,   // 弹簧
        "10007" : 4,   // 金币
        "10008" : 1,   // 金币袋
        "10009" : 1,   // 增强泡泡
        "10010" : 1,   // 增强水柱
        "10011" : 1,   // 增强鞋子
        "10012" : 1,   // 黄金泡泡
        "10013" : 1,   // 黄金水柱
        "10014" : 1,   // 黄金鞋子
        "10015" : 1,   // 乌龟坐骑
        "10016" : 1,   // 小鸟坐骑
        "10017" : 1,   // 飞碟
        "10018" : 8,   // 问号
        "10019" : 6,   // 感叹号
        "10020" : 1,   // 隐身
        "10021" : 1,   // 大力丸
        "10022" : 1,   // 香蕉
    };

    function Prop(data) {
        Prop.super(this);

        this.shadow = null;
        this.item = null;
        this.timeLine = null;

        this.init(data);
    }
    Laya.class(Prop, "Game.Prop", _super);
    var _proto = Prop.prototype;
    _proto.destroy = function () {
        _super.prototype.destroy.call(this, true);

        this.shadow = null;
        this.item = null;
        this.timeLine = null;
    }
    
    _proto.init = function (data) {
        this.createShadow();
        
        this.reset(data);
    }
    _proto.createAni = function () {
        var timeLine = new Laya.TimeLine();
            timeLine.to(this.item, {y : -10}, 400)
                    .to(this.item, {y : -20}, 400);

        this.timeLine = timeLine;
        timeLine.play(0, true);
    }
    _proto.createShadow = function () {
        var shadow = new Laya.Image("res/game/props/shadow.png");
            shadow.alpha = 0.4;
            shadow.anchorX = 0.5;
            shadow.anchorY = 0.5;

        this.shadow = shadow;
        this.addChild(shadow);
    }
    _proto.createItem = function (itemId) {
        var url = "res/game/props/" + itemId + ".png";

        var item = new Laya.Clip(url, PROPS[itemId], 1);
            item.interval = 160;
            item.anchorX = 0.5;
            item.anchorY = 1;
            item.y = -20;

        PROPS[itemId] !== 1 && item.play();
        this.item = item;
        this.addChild(item);
    }
    _proto.recover = function () {
        this.propId = null;
        this.itemId = null;

        this.timeLine.destroy(true);
        this.item.destroy(true);
        this.removeSelf();

        Pool.push(this);
    }
    _proto.reset = function (data) {
        var itemId = data.itemId;
        var point = data.point;

        this.propId = data.propId;
        this.itemId = itemId;

        this.pos(point.x * GAME_MOVE_RATE, point.y * GAME_MOVE_RATE);

        this.createItem(itemId);
        this.createAni();

        return this;
    }

    Prop.create = function (data) {
        if(Pool.length !== 0){
            console.log("Prop Created from %cpool", "color:#f00");
            return Pool.pop().reset(data);
        }else{
            console.log("Prop Created from %cnew", "color:#f00");
            return new Prop(data);
        }
    }
    Prop.clear = function () {
        for(var i in Pool){
            Pool[i].destroy();
            delete Pool[i];
        }
    }
})(Laya.Box);